const express = require('express');
const router = express.Router();
const loginCheck = require('../middleware/loginCheck');

/* GET users listing. */
router.get('/index',loginCheck,function (req, res, next) {
    const { username,realname } = req.session;
    res.render('admin/index', {
        title: '首页',
        username: username,
        realname: realname,
        role: '系统管理员'
    });
});

router.get('/card/manage',loginCheck, function (req, res, next) {
    const list = [];
    for (let i = 1; i <= 100; i++) {
        list.push({
            id: i,
            user: '曹书良' + i,
            status: (i % 2 == 0) ? 0 : 1,
            balance: '1000.00'
        })
    }
    res.render('admin/card_manage', {
        title: '校园卡管理',
        username: '',
        realname: '曹书良',
        role: '系统管理员',
        list: list
    })
});

router.get('/card/add',loginCheck, function (req, res, next) {
    res.render('admin/card_add', {
        title: '校园卡办理',
        username: '',
        realname: '曹书良',
        role: '系统管理员',
    })
});

module.exports = router;
